<% include("../public/commonheader.html"){}%><!-- 配置文件 -->

<div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="L_caption" class="layui-form-label">
                            <span class="x-red">*</span>${L.caption}</label>
                        <div class="layui-input-inline">
                            <input type="text" id="L_caption" name="caption" value="${info.caption!}" lay-verify="required" autocomplete="off" class="layui-input"></div>
                        </div>
                    
                    <div class="layui-form-item">
                        <label for="L_repass" class="layui-form-label">
                            <span class="x-red">*</span>${L.parent}</label>
                        <div class="layui-input-inline">
                            <select name="parent_id">
                              <option value="0">${L.top}</option>
                              <%for(parent in parents){%>
							   <option value="${parent.privi_id!}"<%if(info.parent_id==parent.privi_id){%> selected="true"<%}%>>${parent.caption!}</option>
                              <%}%>
                           </select>
                        </div>
                    </div>

					<div class="layui-form-item">
                        <label for="L_control" class="layui-form-label">
                            <span class="x-red"></span>${L.control}</label>
                        <div class="layui-input-inline">
                            <input type="text" id="L_control" name="control" value="${info.control!}" autocomplete="off" class="layui-input"></div>
                    </div>
					<div class="layui-form-item">
                        <label for="L_action" class="layui-form-label">
                            <span class="x-red"></span>${L.action}</label>
                        <div class="layui-input-inline">
                            <input type="text" id="L_action" name="action" value="${info.action!}" autocomplete="off" class="layui-input"></div>
                    </div>

                    <div class="layui-form-item">
                        <label for="L_submit" class="layui-form-label"></label>
						<input type="hidden" name="privi_id" value="${info.privi_id!0}"/>
                        <button class="layui-btn" lay-filter="edit" lay-submit="">提交修改</button>
				    </div>
                </form>
            </div>
        </div>

<% include("../public/commonfooter.html"){}%>
<script>
layui.use(['form', 'layer','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                //监听提交
                form.on('submit(edit)',
                function(data) {
					$.post(jkas.url("/admin/privileges/edit"),data.field,function(result)
					{
                     if(200==result.code)
					 {
                    //发异步，把数据提交给php
                      layer.alert("修改成功", {
                        icon: 6
                      },
                      function() {
                        //关闭当前frame
                        Sca.close();

                        // 可以对父窗口进行刷新 
                        Sca.father_reload();
                      });
					  }
					  else
					  { layer.alert("操作失败 "+result.msg, {
                        icon: 5
                        });
					  }
				   },"json");
                    return false;
                });

            });
</script>
